package com.front.controller;


import com.front.util.BaseController;
import com.front.util.Result;
import com.front.entity.UserDetail;
import com.front.service.PayService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;


@RestController
@RequestMapping("pay")
public class PayController extends BaseController {
    @Resource
    private PayService payService;

    /**
     * 生成支付二维码
     * @param detail
     * @return
     */
    @PostMapping("getNativeCodeUrl")
    public Result getNativeCodeUrl(@RequestBody UserDetail detail){
        Map map=payService.getNativeByOrder(detail);
        return success(map);
    }

    /**
     * 获取支付状态
     * @param detailId
     * @return
     */
    @GetMapping("getPayStatus/{detailId}")
    public Result getPayStatus(@PathVariable("detailId") String detailId)   {
        Map<String, String> map = payService.getPayStatus(detailId);
        return success(map);
    }
}
